package com.edu.cq01.controller;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

//设置当前类为处理器类
@Controller
@RequestMapping(value="/springMVC")
public class FirstController {
    //设定当前方法的访问映射地址
    @RequestMapping(value = "/firstController",method = {RequestMethod.GET,RequestMethod.POST})
    public ModelAndView sayHello() {
        System.out.println("访问到 FirstController!");

        ModelAndView mv = new ModelAndView();
        mv.addObject("msg","成功了");
        mv.setViewName("success");
        return mv;
    }

}